import pymysql

serverName='localhost'
userName='root'
passWord='0'
db='roam'
conn = pymysql.connect(host=serverName, port=3306, user=userName, passwd=passWord, db=db , charset='utf8')
cursor = conn.cursor()
sqlkey = "INSERT INTO `roam`.`roam_user_info`(`user_id`, `user_acc`, `user_pwd`, `user_name`, `user_chara`, `user_spirit`, `user_head`, `user_acc_select`, `user_first_time`, `user_last_time`, `character_select`, `spirit_select`, `head_select`)VALUES  "
for i in range(1,30):
    user_id =str(i)
    user_acc="useracc"+str(i)
    user_pwd=str(i)+"213212"
    user_name="青城旅客"
    if(i%2==0):
        user_chara=str(1)
        user_spirit=str(1)
    elif(i%3==0):
        user_spirit = str(2)
        user_chara = str(2)
    else:
        user_spirit = str(3)
        user_chara = str(2)
    sqlv="(%s, %s, %s,%s,%s,%s,'https://iconfont.alicdn.com/t/603978b2-2846-4fce-adaa-34e8ca37cf29.png','mail','2021-10-12 11:26:21', '2021-11-08 11:26:26', 0, 0, 0)"
    cursor.execute(sqlkey+sqlv, (user_id, user_acc,user_pwd,user_name,user_chara,user_spirit))
    conn.commit()
print("执行完成")
conn.close()
cursor.close()